﻿<template>
    <div>
        <input type="file" @change="handleFileSelect" />
    </div>
</template>

<script setup lang="ts">
import api from '@/apis/upload';
// 文件选择处理
const handleFileSelect = (event: any) => {
    const file = event.target.files[0];

    const { name, size } = file;
    const formData = new FormData();
    formData.append('file', file);
    formData.append('name', name);
    formData.append('size', size);
    // console.log(`选中文件: ${file.name}, 大小: ${file.size} bytes`);
    api.uploadTest(formData).then(res => {
        console.log(res);
    });
};
</script>

<style scoped lang="scss"></style>
